package platform.http;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpRequestEncoder;

public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) throws Exception {
        // 解码
        socketChannel.pipeline().addLast(new HttpRequestEncoder());
        // 编码
        socketChannel.pipeline().addLast(new HttpRequestDecoder());
        // 添加接收数据实现方法
        socketChannel.pipeline().addLast(new MyServerHandler());
    }
}
